[Discussion] using Apollo Client's queryPreloader
in TanStack router loaders
#1675
+256
−31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please don't merge, this is just a PR because it allows me to easily highlight code changes to the default example :)
We talked about support for Apollo Client's
queryPreloader
in TanStack router loaders yesterday, and I promised you a write-up what we need.Having created this example, I'm not even sure if we need anything more at this point 😅
Generally, we need these things:
loader
function return valuesloader
function values as soon as possibleuseLoaderData
is calledclient
increateRouter
, but it would be even better if the transformer had access to the currentcontext
in some way - this way,router.update
could change the client instance without things breaking.So, this is much less of a feature request than I initially imagined - more of a bunch of questions at this point:
transformer
return objects that containPromise
intances?@defer
, where the response arrives in chunks, so this would be really cool!context
to thetransformer
?transformer
? Could be useful if more libraries start shipping transformers :)Adding @jerelmiller to the discussion, too :)